import 'package:city_corner/commons/global-var.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:city_corner/detail-page/reservation/index.dart';

class BottomPanel extends StatelessWidget {
  double width = 0.0;

  Widget btnContainer(double width, int color, String text) {
    return Container(
      height: 50.0,
      alignment: Alignment.center,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(5.0),
        color: Color(color),
      ),
      width: width,
      child: Text(text, style: TextStyle(color: Colors.white)),
    );
  }

  @override
  Widget build(BuildContext context) {
    width = MediaQuery.of(context).size.width;
    double btnWidth = (width - 80) / 2;
    BtnColor btnColor = new BtnColor();

    return Container(
      decoration: BoxDecoration(
          color: Colors.white,
          boxShadow: [BoxShadow(blurRadius: 2.0, color: Color(0xff8c8c8c))]),
      height: 60.0,
      width: width,
      padding: EdgeInsets.only(left: 10.0, right: 10.0),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          InkWell(
              onTap: () {
                print('!!!');
                Navigator.push(context, MaterialPageRoute(builder: (_) {
                  return Reservation();
                }));
              },
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Icon(Icons.today),
                  Text('预约看房', style: TextStyle(fontSize: 10.0))
                ],
              )),
          Row(children: [
            btnContainer(btnWidth, btnColor.yellow, "在线聊"),
            SizedBox(width: 5.0),
            btnContainer(btnWidth, btnColor.orange, "打电话"),
          ])
        ],
      ),
    );
  }
}
